﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TaobaoERP.Core.Common;
using TaobaoERP.BusinessTaobao.TaobaoAPI;

namespace TaobaoERP.Controllers
{
    public class LoginFilterAttribute : ActionFilterAttribute
    {
        public override void OnActionExecuting(ActionExecutingContext  filterContext)
        {

            if (string.IsNullOrEmpty(Utils.GetCookies("isp_username")))
            {
                if (string.IsNullOrEmpty(Utils.GetCookies("sessionid")))
                    Utils.SetCookies("sessionid", System.Web.HttpContext.Current.Session.SessionID);
                System.Web.HttpContext.Current.Response.Redirect(new TaobaoAPI(Utils.GetCookies("sessionid")).login());

            }
            base.OnActionExecuting(filterContext);
        }

       
    }
}
